package com.doit.spark.day06



/**
 * @DATE 2022/1/9/15:19
 * @Author MDK
 * @Version 2021.2.2
 * */
object Test01 {
  def main(args: Array[String]): Unit = {
    val arr = Array[IpRuleBean](
      IpRuleBean(16777472, 16778239, "亚洲", "中国", "日本", "", ""),
        IpRuleBean(16779264, 16781311, "亚洲", "中国", "日本", "", ""),
        IpRuleBean(16785408, 16793599, "亚洲", "中国", "日本", "", ""),
        IpRuleBean(16842752, 16843007, "亚洲", "中国", "日本", "", "")
    )
    val ip = "1.1.0.2"
    println(IpUtils.ipToLong(ip))
    val index = IpUtils.binarySearch(arr, ip)
    println(index)
  }
}
